#define _CRT_SECURE_NO_WARNINGS 1

//https://leetcode.cn/problems/check-permutation-lcci/

class Solution {
public:
    bool CheckPermutation(string s1, string s2) {
        if (s1.size() != s2.size()) return false;

        int hash[26];
        for (auto ch : s1) hash[ch - 'a']++;
        for (auto ch : s2) if (--hash[ch - 'a'] == -1) return false;

        return true;
    }
};